/*
 * FileNameSequence.cpp
 *
 *  Created on: Apr 9, 2012
 *      Author: lfelipe
 */

#include <sstream>

#include "FileNameSequence.h"


FileNameSequence::FileNameSequence(std::string base_name,std::string end_name)
{
    this->sequence_ = 0;
    this->base_name_ = base_name;
    this->end_name_ = end_name;
}

std::string FileNameSequence::generate_name(std::string name)
{
    std::stringstream oss;
    if(!name.empty()){
        oss << base_name_ << "-" << name<< "-"<< ++sequence_ << end_name_;
    } else {
        oss << base_name_ << "-" << ++sequence_ << end_name_;
    }
    return oss.str();
}

FileNameSequence::~FileNameSequence()
{

}

std::string FileNameSequence::base_name()
{
    return base_name_;
}



std::string FileNameSequence::generate_name_and_time()
{
    std::stringstream oss;
    oss << base_name_ << "_" << gerenate_time_string() << ++sequence_ << end_name_ ;
    return oss.str();

}

std::string FileNameSequence::generate_name_time_and_sequence()
{
    std::stringstream oss;
    oss << base_name_ << "_" << gerenate_time_string() << "-" << ++sequence_ << end_name_;
    return oss.str();
}

void FileNameSequence::set_base_name(std::string base_name)
{
    this->base_name_ = base_name;
}

std::string FileNameSequence::gerenate_time_string()
{
    std::stringstream oss;
    oss << Time::year() << "_" << Time::month()  << "_" << Time::day()  << "_" << Time::hour() << "_" << Time::min() << "_" << Time::sec();
    return oss.str();
}

std::string FileNameSequence::generate_name_and_sequence()
{
    std::stringstream oss;
    oss << base_name_ <<  "-" << ++sequence_ << end_name_;
    return oss.str();
}







